<template>
    <div id="app">
        <el-card >
            <el-upload
                    class="avatar-uploader"
                    action="http://localhost:9000/file-upload"
                    :show-file-list="false"
                    :on-success="handleAvatarSuccess">
                <img v-if="imageUrl" :src="imageUrl" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
        </el-card>
    </div>
</template>

<script>
    export default {
        name: "Upload",
        data(){
            return{
                imageUrl: ''
            }
        },
        methods:{
            handleAvatarSuccess(res, file) {
                console.log(res);
                this.imageUrl = res.data;
            }
        }
    }
</script>

<style scoped>

</style>
